from time import sleep
from page_locators.school_profile_locator import SchoolProfileLocators as SPL
from common.base_page import BasePage 
from test_datas.string_datas import *
from test_datas.pic_data import *


class SchoolProfile(BasePage):

    def __init__(self,driver):
        super().__init__(driver)
        
    def upload_logo1(self):
        self.upload_file(SPL.upload_logo, getFile_png, "上传logo")
        self.back()
        sleep(1)
        self.forward()

    def upload_logo2(self):
        self.upload_file(SPL.upload_logo, webp_path, "上传logo")


    def upload_logo3(self):
        self.upload_file(SPL.upload_logo, big_path, "上传logo")


    def upload_logo4(self):
        self.upload_file(SPL.upload_logo, png, "上传logo")
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')
        
    def introduction_error1(self):
        self.input(SPL.introduction, character_1001, '简介输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def introduction_error2(self):
        self.input(SPL.introduction, character_1000, '简介输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def introduction_success1(self):
        self.input(SPL.introduction, character_999, '简介输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def introduction_success2(self):
        self.input(SPL.introduction, character_500, '简介输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def introduction_success3(self):
        self.input(SPL.introduction, '', '简介输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def note_error1(self):
        self.input(SPL.note, character_201, '备注输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def note_error2(self):
        self.input(SPL.note, character_100, '备注输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def note_success1(self):
        self.input(SPL.note, character_99, '备注输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')


    def note_success2(self):
        self.input(SPL.note, '', '备注输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, '保存按钮定位失败截图')

    def clear_all_inputbox(self):
        self.upload_file(SPL.upload_logo, facepic_2MB, "上传logo")
        self.input(SPL.introduction, ' ', '简介输入框定位失败截图')
        sleep(1)
        self.input(SPL.note, ' ', '备注输入框定位失败截图')
        sleep(1)
        self.click(SPL.school_profile_savesub, "保存按钮定位")